package com.yiyuan.app.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.guaike.core.mybatis.plugins.BaseDAO;
import com.yiyuan.app.entity.po.MRankPineconePO;
import com.yiyuan.app.mapper.MRankPineconeMapper;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public class MRankPineconeDAO extends BaseDAO<MRankPineconeMapper, MRankPineconePO> {


    public List<MRankPineconePO> findRankList(LocalDate startOfLastWeek, LocalDate endOfLastWeek) {
        LambdaQueryWrapper<MRankPineconePO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MRankPineconePO::getStartDate, startOfLastWeek);
        queryWrapper.eq(MRankPineconePO::getEndDate, endOfLastWeek);
        queryWrapper.orderByAsc(MRankPineconePO::getRankNo);
        return getBaseMapper().selectList(queryWrapper);
    }
}
